package com.beidu.lottery.call.constant;

import lombok.Getter;
import org.springframework.util.StringUtils;

@Getter
public enum ActivityGroundingStatusEnum {
    /**
     * ActivityType
     */
    ACTIVITY_OFF_SHELF(0,0,"活动下架"),
    ACTIVITY_GROUNDING(1,1,"活动上架"),
    ACTIVITY_DRAFT(2,2,"活动草稿"),
    ACTIVITY_EXPIRED(3,3,"活动过期"),

    ;

    /**
     * id
     */
    public Integer id;

    /**
     * code
     */
    public Integer code;
    /**
     * msg
     */
    public String msg;

    ActivityGroundingStatusEnum(Integer id, Integer code, String msg) {
        this.id = id;
        this.code = code;
        this.msg = msg;
    }

    public static ActivityGroundingStatusEnum findByCode(Integer code) {
        if (StringUtils.isEmpty(code)) {
            return null;
        }
        for (ActivityGroundingStatusEnum statusEnum : ActivityGroundingStatusEnum.values()) {
            if (statusEnum.code.equals(code)) {
                return statusEnum;
            }
        }
        return null;
    }

    public static ActivityGroundingStatusEnum findByMsg(String msg) {
        if (StringUtils.isEmpty(msg)) {
            return null;
        }
        for (ActivityGroundingStatusEnum statusEnum : ActivityGroundingStatusEnum.values()) {
            if (statusEnum.msg.equals(msg)) {
                return statusEnum;
            }
        }
        return null;
    }

    public static ActivityGroundingStatusEnum findById(String id) {
        if (StringUtils.isEmpty(id)) {
            return null;
        }
        for (ActivityGroundingStatusEnum statusEnum : ActivityGroundingStatusEnum.values()) {
            if (statusEnum.id.equals(id)) {
                return statusEnum;
            }
        }
        return null;
    }

}
